#!/usr/bin/env ruby
require 'rubygems'
$:.unshift '/Users/rogerpack/dev/ramaze_git/lib'
$:.unshift File.dirname(__FILE__) + '/../'
require 'ramaze'
def dbg; require 'ruby-debug'; debugger; end


# to see that this works, ruby start.rb, then
# compare the timing  of
#  time ab -n 50 -c 10 http://127.0.0.1:7000/mixed_old_school
#  time ab -n 50 -c 10 http://127.0.0.1:7000/mixed_new_school
 



use_evented_and_fibered = true
if use_evented_and_fibered

  # in order to use evented with 1.9, you actually need to go into your mongrel itself and require 'swiftcore/evented_mongrel' at the end of it,
  # and then require '../fibered_mongrel.rb' after that
  # this to overcome a bug in Ramaze
  # in my own code, I set it to load these files if I had defined certain constants
  
  EVENTED_MONGREL = true
  EVENTED_FIBERED_MONGREL = true
  # this causes the err on 1.9 require 'swiftcore/evented_mongrel'
  # also note that 
  # you'll need to go into ramaze and discourage it from starting a thread with each response [since we use fibers to supplant threads]
  # i.e. go into lib/ramaze/adapter/base.rb
  # and change def respond [at the bottom]
  # to not spawn them
  #
  #      def respond(env)
  #        if false #Global.server.respond_to?(:thread) and Global.server.thread == Thread.current # changed line
  # 		...

end

# require all controllers and models
acquire __DIR__/:controller/'*'
acquire __DIR__/:model/'*'

Ramaze.start :adapter => :evented_mongrel, :port => 7000 # you may need the svn version of ramaze for :evented_mongrel to work here

